<?php

/*
Edit Trivia Question (admin_edit_trivia_question.php)
*/

$page_title = "Edit Trivia Question";
$rank_check = 7;
include "../header.inc.php";

print "$openHTML";

$find_games = mysql_query("SELECT id,gamename FROM trivia_games WHERE game = '$game'");

$get_question = fetch("SELECT * FROM trivia_questions WHERE id = '$question' AND game = '$game'");

$ans = $get_question[answer];
$checked[$ans] = " CHECKED";

$trivia = $get_question[trivia_game];

while ($get_games = mysql_fetch_array($find_games))
{
	$id = $get_games[id];
	if ($get_games[id] == $trivia)
	{
		$select[$id] = " SELECTED";
	}
	$list_games .= "<option value=$get_games[id]$select[$id]>$get_games[gamename]";
}

ECHO <<<END

<P>To edit a question, enter a question and two, three or four possible answers, indicating which one is correct by clicking the bubble next to it.</P>

<FORM ACTION="admin_edit_trivia_q.pro.php?game=$game" METHOD=POST><input type=hidden name=edit_id value=$get_question[id]> <CENTER><TABLE BGCOLOR="$tableOutline"
CELLSPACING=1 CELLPADDING=0 WIDTH=98%>

<TR BGCOLOR="$topAndBottomBG"> <TD COLSPAN=2 HEIGHT=50>
<CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Trivia Question--</FONT></CENTER> </TD> </TR>

<TR
BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Question:</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="edit_question" VALUE="$get_question[question]" SIZE=43
MAXLENGTH=255></FONT></P> </TD> </TR>

<TR BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40>
<P>Answer A</P> </TD> <TD HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text
NAME="answer1" VALUE="$get_question[answer1]" SIZE=43 MAXLENGTH=128><input type=radio name=answer value=1$checked[1]></FONT></P> </TD> </TR>

<TR
BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Answer B</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="answer2" VALUE="$get_question[answer2]" SIZE=43
MAXLENGTH=128><input type=radio name=answer value=2$checked[2]></FONT></P> </TD> </TR>

<TR BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40>
<P>Answer C</P> </TD> <TD HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text
NAME="answer3" VALUE="$get_question[answer3]" SIZE=43 MAXLENGTH=128><input type=radio name=answer value=3$checked[3]></FONT></P> </TD> </TR>

<TR
BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Answer D</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="answer4" VALUE="$get_question[answer4]" SIZE=43
MAXLENGTH=128><input type=radio name=answer value=4$checked[4]></FONT></P> </TD> </TR>

<TR BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40>
<P>Trivia Game:</P> </TD> <TD HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<SELECT NAME=trivia_game>$list_games</SELECT></FONT></P> </TD> </TR>

<TR> <TD
COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG"> <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT
TYPE=submit NAME=Submit VALUE="Edit Question"></I></FONT></CENTER> </TD> </TR> </TABLE>
</CENTER> </FORM>

END;

print "$closeHTML";
?>
